﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using ThePingMasterConfiguration.Services;

namespace ThePingMasterConfiguration.Commands
{
    public class MessageCommand : ICommand
    {
        private readonly string _message;
        private readonly IMessageService _messageService;

        public MessageCommand(string message, IMessageService messageService)
        {
            if (messageService == null) throw new ArgumentNullException("messageService");
            if (String.IsNullOrWhiteSpace(message)) throw new ArgumentNullException("message");
            _message = message;
            _messageService = messageService;
        }

        public void Execute(object parameter)
        {
            _messageService.ShowMessage(_message);
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}
